<?php
namespace app\index\controller;
use think\Reqrest;
use think\Controller;
class Index extends Controller
{
    public function index()
    {
         return view();
    }

    public function add()
    {
    	$data = input('post.');
    	$model = model('User');
    	$res = $model->adds($data);
    	// var_dump($res);

    	if($res)
    	{
    		$this->success('添加成功','index/show');
    	}else{
    		$this->error('添加失败');
    	}
    }

    public function show()
    {
    	$model = model('User');
    	$res = $model->selAll('vip');

    	$this->assign('data',$res);
    	return view('show');
    }

    public function del()
    {
    	$id = input('id');
    	//echo $id;die;
    	$model = model('User');
    	$res = $model->del($id);
    	 
    	 if($res)
    	 {
    	 	$this->success('删除成功','show');
    	 }else{
    	 	$this->error('删除失败');
    	 }
    }
}
